//
//  TSPublishController.m
//  TaShuo
//
//  Created by N-X on 2018/3/22.
//  Copyright © 2018年 MRNAN. All rights reserved.
//

#import "TSPublishController.h"
#import "TSPublishViewModel.h"
@interface TSPublishController ()
@property (nonatomic ,strong)TSPublishViewModel * publishVM;
@end

@implementation TSPublishController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.tableView];
    @weakify(self)
    [[self.publishVM.requestPulishDataCommand execute:nil] subscribeNext:^(id  _Nullable x) {
        @strongify(self)
        [self.tableView reloadData];
    } error:^(NSError * _Nullable error) {
        
    }];
    [self.publishVM bindView:self.tableView];
}

#pragma mark - lazy load
- (UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight - self.navigationBarHeight - self.tabBarHeight)];
    }
    return _tableView;
}

- (TSPublishViewModel *)publishVM
{
    if (!_publishVM) {
        _publishVM = [[TSPublishViewModel alloc]init];
    }
    return _publishVM;
}
@end
